<?php
class CommentsController extends AppController {
    var $name = "Comments";
	var $uses = array('Comment','Item','User');
	
	function add($item_id=null) {
		
		$this->set('item', $item_id);
		$user = $this->Session->read('Auth.User');
		$this->set('user', $user);
				
		if (!empty($this->data)) {
			if ($this->Comment->save($this->data)) {
				$this->Session->setFlash('Comment saved.');
				$this->redirect(array('controller'=>'items', 'action' => 'view',$this->data['Comment']['item_id']));
			}
		}
		
	}

}
?>